//
//  CLControllerTool.h
//  toroBracelet
//
//  Created by 丁益 on 16/7/19.
//  Copyright © 2016年 celi. All rights reserved.
//  负责控制器相关的操作

#import "CLControllerTool.h"
#import "UIImage+Fit.h"
#import "CLSeverTool.h"
#import "ViewController.h"
#import "DYLeftViewController.h"
#import "AppDelegate.h"
#import "DYTabBarViewController.h"

@implementation CLControllerTool
+ (void)chooseRootViewController
{

//    BOOL isLogin = [CLSeverTool getHasLoginStats];
//    BOOL isSettingProfile = [CLSeverTool getSettingProFileStats];
    
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    [UIApplication sharedApplication].statusBarHidden = NO;
    
    DYTabBarViewController *mainVc = [[DYTabBarViewController alloc]init];

    window.rootViewController = mainVc;

    
    
    //1.展示新特性页
    
    //2.登录注册页
    /*if (isLogin == NO) {
        CLLoginViewController *loginVc = [[CLLoginViewController alloc]initWithLoginSuccess:^(UIViewController *vc) {
  
            [CLSeverTool saveHasLoginStats:YES];
            
            //3.用户个人信息设置引导页
            if (isSettingProfile == NO){ //没有加载设置引导页
                CLGuideSexController *guideVc = [[CLGuideSexController alloc]init];
                [vc.navigationController pushViewController:guideVc animated:NO];
                [CLSeverTool saveSettingProFileStats:YES];
            } else {
                 window.rootViewController = [[CLTabBarViewController alloc]init];
            }
            
        }];
        
        CLNavigationController *nav = [[CLNavigationController alloc]initWithRootViewController:loginVc];
        window.rootViewController = nav;
        return;
    }
    
    window.rootViewController = [[CLTabBarViewController alloc]init];*/
   /* // 如何知道第一次使用这个版本？比较上次的使用情况
    NSString *versionKey = (__bridge NSString *)kCFBundleVersionKey;
    
    // 从沙盒中取出上次存储的软件版本号(取出用户上次的使用记录)
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *lastVersion = [defaults objectForKey:versionKey];
    
    // 获得当前打开软件的版本号
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[versionKey];
    
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    if ([currentVersion isEqualToString:lastVersion]) {
        // 当前版本号 == 上次使用的版本：显示HMTabBarViewController
        [UIApplication sharedApplication].statusBarHidden = NO;
        window.rootViewController = [[HMTabBarViewController alloc] init];
    } else { // 当前版本号 != 上次使用的版本：显示版本新特性
        window.rootViewController = [[HMNewfeatureViewController alloc] init];
        
        // 存储这次使用的软件版本
        [defaults setObject:currentVersion forKey:versionKey];
        [defaults synchronize];
    }*/
}


- (void)dealloc{

    DLog(@"CLControllerTool---------");
}
@end
